home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 8
/
Aminet 8 (1995)(GTI - Schatztruhe)[!][Oct 1995].iso
/
Aminet
/
text
/
edit
/
FrexxShell.lha
/
FrexxShell.FPL
next >
Wrap
Text File
|
1995-07-10
|
2KB
|
99 lines
/* FrexxEd Shell Environment
by Carsten Orthbandt
$VER: FrexxShell V 1.0 5.7.95
Read FrexxShell.FPL.README for further information
*/
int bufferid;
string currentdir;
string cmdfname,outfname,dirfname,errfname;
void DoShellCmnd(string cmd)
{
int errc;
SaveString(cmdfname,"failat 21\ncd \""+currentdir+"\"\n"+cmd+" <NIL: >"+outfname+"\ncd >"+dirfname+"\n");
errc=System("Execute >>"+outfname+" "+cmdfname,"",errfname);
GotoLine(-1,0);
InsertFile(outfname);
Output(LoadString(errfname));
currentdir=LoadString(dirfname);
currentdir=substr(currentdir,0,strlen(currentdir)-1);
Output(currentdir+">");
SetInfo(-1,"changes",0);
};
export void TabFNC()
{
int cmndstrt,flns;
string cmline,flnm,nflnm;
string files[1];
int filecnt;
if (GetBufferID()==bufferid)
{
GotoLine(-1,260);
cmline=GetLine();
cmndstrt=strstr(cmline,">",0)+1;
cmline=substr(cmline,cmndstrt,-1);
flns=strlen(cmline)-1;
if (flns!=-1){
while ((flns>=0)&&(cmline[flns] != ' ')&&(cmline[flns] != '\"'))
{flns--;};flns++;}
else{flns=0;};
flnm=substr(cmline,flns,-1);
cmline=substr(cmline,0,flns);
if (strlen(flnm)==0){flnm=currentdir;};
nflnm=flnm;
filecnt=GetFileList(nflnm+"#?",&files);
if(RequestWindow("Select File",50,"","A",&files,&nflnm,filecnt))
{
cmline=cmline+nflnm;
}else
{
cmline=cmline+flnm;
}
GotoLine(-1,cmndstrt);DeleteEol();
Output(cmline);
}else
{
Output("\t");
}
}
export void ProcessShellCmndLine()
{
int cmndstrt;
string cmline;
cmline=GetLine();
Output("\n");
if (GetBufferID()==bufferid)
{
GotoLine(-1,260);
cmndstrt=strstr(cmline,">",0)+1;
cmline=substr(cmline,cmndstrt,-1);
if (strlen(cmline)>0)
{DoShellCmnd(cmline);}else{DoShellCmnd("Echo");};
System("Delete "+outfname,"","NIL:");
}
};
void SetupFrexxShell()
{
string bfids;
AssignKey("ProcessShellCmndLine();","'Enter'");
AssignKey("TabFNC();","'Tab'");
currentdir="SYS:";
bufferid=New();
Activate(bufferid,1);
CurrentBuffer(bufferid);
Rename("FrexxCon");
bufferid=GetBufferID("FrexxCon");
bfids=itoa(bufferid);
cmdfname="T:FShCmd_"+bfids;
outfname="T:FShOut_"+bfids;
dirfname="T:FShDir_"+bfids;
errfname="T:FShErr_"+bfids;
DoShellCmnd("echo FrexxShell by Carsten Orthbandt");
};
SetupFrexxShell();